import { System,LocalTime,Route , Setting,Menu} from "./global.slint";
import { HomePage } from "./page/home_page.slint";
import { SettingPage } from "./page/setting_page.slint";
import { MenuPage } from "./page/menu_page.slint";
import  "./font/simhei.ttf";

export { System,LocalTime,Setting ,Menu}

export component MainView inherits Window {
    background: black;
    width: System.screen_width;
    height: System.screen_height;
    default-font-family: "黑体";


    if System.route==Route.HomePage: HomePage{}
    if System.route==Route.SettingPage: SettingPage{}
    if System.route==Route.MenuPage: MenuPage{}

    // 显示帧率
    if Setting.fps == true:Rectangle {
        padding: 2px;
        x:0px;
        y:0px;
        width: fps.width;
        height: fps.height;
        background: black;
        fps:=Text {
            font-size: 20px;
            text: @tr("FPS:{}",System.fps);
            color: white;
        }
    }

    TouchArea {
        x:0px;y:0px;
        height: 40px;
        width: 40px;

        clicked => {
            if(System.route == Route.HomePage){
                System.route = Route.MenuPage;
            }else{
                System.route = Route.HomePage;
            }
        }
    }

}